
***********************************************
***********************************************
***********************************************
*** 	Replication File 
*** 	Paper Title: Policy-making in Multi-Level Systems: Ideology, Authority, and Education
*** 	Authors: Julian Garritzmann, Leonce Röth & Hanna Kleider
*** 	in: Comparative Political Studies
*** 	contact information: leonce.roeth@uni-koeln.de  garritzmann@soz.uni-frankfurt.de  hanna.kleider@kcl.ac.uk
***********************************************
***********************************************
***********************************************


	* The operation of the do-file relies on the installation of three additional packages | so please install the following
	
	* | ssc install ebalance
	* | ssc install mdesc
	* | install package st0039  | for xtserial
	* | install package grc1leg | for the combination of graphs
	
	* use: Link to the data *

	xtset region_id year

	* Define directory for saved graphs! For example cd c:\
	
	* cd d:\
	
* Structure of the do-file
	
	* Article
		* 1) Distributions across treatment and control cases | Table 1
		* 2) Descriptive distributions of key variables | Figure 1
		* 3) Models | Table 3 & Figure 2
		* 4) Interactions
		* 5) Primary and secondary spending
		* 6) Tertirary spending

	* Online Appendix
		* 1) Data and descriptives
		* 2) Identification of useful controls
		* 3) Robustness
			* 3.1) Missings, balance and descriptives
			* 3.2) Identifying useful controls 

	
	* 1) Distributions across treatment and control cases | Table 1 
		
		* install ebalance if neccessary | ssc install ebalance
			ebalance sm_binary cap_national_economic ideological_proximity reai duration_y  nr_parties_gov perc14 pop_ipep log_density const_gdppc_ipep gdp_growth mountain_region language_region  unemp   special   number_region  rai_self_rule rai_shared_rule rai_overall if  const_edupc!=. 
	
	* 2) Descriptive distributions of key variables | Figure 1
	
		* count of regions in sample
			sort country_id r_id year
			by r_id, sort: gen nvals = _n==1 
			count if nvals
		
			label define reai__axis 0 "AT, DK, IT, NO, SE, UK" 5 "FR" 10 "JP" 15 "BE before devolution" 20 "AU" 37 "CH" 40 "ES" 50 "BE" 60 "CA, DE, UK, USA", replace
			quietly: graph box const_edupc if year>1990 & const_edupc!=., over(reai) vertical 
			graph save 10.gph, replace
			label define reai_axis 0 ""  5 "" 6 "", replace
			quietly: graph box ml_roeth  if year>=1990 & const_edupc!=., over(reai) vertical
			graph save 11.gph, replace
			quietly: graph box cap_national_economic if year>1990 & const_edupc!=., over(reai) vertical 
			graph save 12.gph, replace
			graph combine  10.gph  11.gph 12.gph, xcommon rows(3) 

	
	* 3) Models | Table 3 & Figure 2
	
		* Test autocorrelation | install package for xtserial if neccessary | ssc install st0039
			xtserial const_edupc ml_roeth reai   ideological_proximity cap_national_economic mountain_region unemp log_density perc14  special language_region pop_ipep const_gdppc_ipep gdp_growth number_region duration_y nr_parties_gov
		* ac exists - take care of it in the models!

		* Region fixed effects with clustered se on country level | Model 1 in Table 3
			xtregar const_edupc  ml_roeth reai   ideological_proximity cap_national_economic mountain_region unemp log_density perc14  special language_region pop_ipep const_gdppc_ipep gdp_growth number_region duration_y nr_parties_gov, fe 

		
		* Multilevel  | Model 2 in Table 3
			xtmixed const_edupc  ml_roeth reai   ideological_proximity cap_national_economic mountain_region unemp log_density perc14  special language_region pop_ipep const_gdppc_ipep gdp_growth number_region duration_y nr_parties_gov  || country_id:||r_id:,var mle cov(un) res(ar 1, t(year))
			*eststo model2
	
	* 4) Interactions ideologie and authority
	
		* Interaction of authority over education with regional government ideology | Model 3 Table 3 & Figure 2
	
		* Simple multiplicative dimension of scope * depth 
			xtmixed const_edupc  c.ml_roeth##c.reai ideological_proximity cap_national_economic mountain_region unemp log_density perc14  special language_region pop_ipep const_gdppc_ipep gdp_growth number_region duration_y nr_parties_gov || country_id:||r_id:,var mle cov(un) res(ar 1, t(year))
			margins, dydx(ml_roeth) at (reai=(0 (1) 6))
			marginsplot, recast(scatter) scheme(s1mono) yline(0) ytitle("marginal effect") ///
			xtitle("Level of regional authority over education") title("Marginal effect of regional government ideology")
			graph save 1.gph, replace
			*eststo model3
			
			* Check bias with restricted maximum likelihood versus full maximum likelihood (reml versus mle) because of small n on the first level // no difference
			xtmixed const_edupc  c.ml_roeth##c.reai ideological_proximity cap_national_economic mountain_region unemp log_density perc14  special language_region pop_ipep const_gdppc_ipep gdp_growth number_region duration_y nr_parties_gov || country_id:||r_id:,var reml cov(un) res(ar 1, t(year))
			margins, dydx(ml_roeth) at (reai=(0 (1) 6))
			marginsplot, recast(scatter) scheme(s1mono) yline(0) ytitle("marginal effect") ///
			xtitle("Level of regional authority over education") title("Marginal effect of regional government ideology")
		
		* Interaction of authority over education with state-wide government ideology | Model 4 Table 3 & Figure 2
			xtmixed const_edupc c.cap_national_economic##c.reai  ml_roeth ideological_proximity  mountain_region unemp log_density perc14  special language_region pop_ipep const_gdppc_ipep gdp_growth number_region duration_y nr_parties_gov || country_id: || r_id:,var mle cov(un) res(ar 1, t(year))
			margins, dydx(cap_national_economic) at (reai=(0 (1) 6))
			marginsplot, recast(scatter) scheme(s1mono) yline(0) ytitle("marginal effect") ///
			xtitle("Level of regional authority over education") title("Marginal effect of national government ideology")
			graph save 2.gph, replace
			*eststo model4
		
			graph combine  1.gph  2.gph , ycommon rows(1) // Figure 3
			graph save interaction.gph, replace
				
		* Check without controls - regional level | Figure A.13
			xtmixed const_edupc  c.ml_roeth##c.reai  || country_id:||r_id:,var mle cov(un) res(ar 1, t(year))
			margins, dydx(ml_roeth) at (reai=(0 (1) 6))
			marginsplot, recast(scatter) scheme(s1mono) yline(0) ytitle("marginal effect") ///
			xtitle("Level of regional authority over education") title("Marginal effect of regional government ideology")
			graph save 3.gph, replace

		* Check without controls - state-wide level | Figure A.13
			xtmixed const_edupc c.cap_national_economic##c.reai   || country_id: || r_id:,var mle cov(un) res(ar 1, t(year))
			margins, dydx(cap_national_economic) at (reai=(0 (1) 6))
			marginsplot, recast(scatter) scheme(s1mono) yline(0) ytitle("marginal effect") ///
			xtitle("Level of regional authority over education") title("Marginal effect of national government ideology")
			graph save 4.gph, replace
			graph combine  3.gph  4.gph , ycommon rows(1)
						
	* 5) Primary and secondary (plus others) - tertiary excluded and missings on tertiary turned into missings as well
			sum const_edupc_whe const_edupc  const_uedupc
			replace const_edupc_whe=. if const_uedupc==.
		
		* Normal fixed effects | Model (5) in Table 3
			xtregar const_edupc_whe  ml_roeth reai_b   ideological_proximity cap_national_economic mountain_region unemp log_density perc14  special language_region pop_ipep const_gdppc_ipep gdp_growth number_region duration_y nr_parties_gov , fe  

		* Multilevel | Model (6) in Table 3
			xtmixed const_edupc_whe  ml_roeth reai_b   ideological_proximity cap_national_economic mountain_region unemp log_density perc14  special language_region pop_ipep const_gdppc_ipep gdp_growth number_region duration_y nr_parties_gov || country_id: ||r_id:,var mle cov(un) res(ar 1, t(year))
			*eststo model5
					
	* 6) Tertirary spending
		* Test autocorrelation
			xtserial const_uedupc ml_roeth reai   ideological_proximity cap_national_economic mountain_region unemp log_density perc14  special language_region pop_ipep const_gdppc_ipep gdp_growth number_region duration_y nr_parties_gov
			* ac exists - take care of it in the models!

		* Region fixed effects | Model (7) in Table 3
			xtregar const_uedupc  ml_roeth reai_b   ideological_proximity cap_national_economic mountain_region unemp log_density perc14  special language_region pop_ipep const_gdppc_ipep gdp_growth number_region duration_y nr_parties_gov , fe 
	
		* Multilevel | Model (8) in Table 3
			xtmixed const_uedupc  ml_roeth reai_b   ideological_proximity cap_national_economic mountain_region unemp log_density perc14  special language_region pop_ipep const_gdppc_ipep gdp_growth number_region duration_y nr_parties_gov || country_id:   ||r_id:,var mle cov(un) res(ar 1, t(year))
			*eststo model5
	
	
	
	
	
*#### Online Appendix   #######*

	
	* 5) Robustness
	
		* 5.1) Missings on the dependent variable
			mdesc  ml_roeth  language_region mountain_region unemp log_density perc14 special pop_ipep const_gdppc_ipep gdp_growth number_region duration_y seat_share_gov nr_parties_gov cap_national_economic rai_self_rule rai_shared_rule rai_overall const_edupc reai depth_education
		
		* Missings at random?
			list countryname region year if const_edupc==.
		
		* we have three types of missings
		
		* 1) missing in time series for specific region-years

			gen m1=0
			replace m1=1 if const_edupc==. & countryname=="USA" | const_edupc==. & countryname=="Canada" & region!="Northwest" | const_edupc==. & countryname=="Denmark" & year>1994 // 247
			list region country year if m1==1
			sum m1 if m1==1
				
		*2) Data for specific region is entirely missing
			gen m=0
			replace m=1 if const_edupc==.
			egen p=mean(m), by(region)
			gen m2=0 
			replace m2=1 if p==1
			sum m2 if m2==1 //248
			list region country year if m2==1
		
				*those one we could impute and compare model results. 
		
		* 3) Systematic missings for regions for longer time periods  
			gen m3=m
			replace m3=0 if m2==1 | m1==1
			sum m3 if m3==1  //1,876
			list region country year if m3==1 & countryname!="Japan"

		* Missings at random | Table A4
		
			* Install mdesc if neccessary | ssc install mdesc
			mdesc  ml_roeth  language_region mountain_region  log_density perc14 special pop_ipep const_gdppc_ipep gdp_growth number_region duration_y seat_share_gov nr_parties_gov cap_national_economic rai_self_rule rai_shared_rule reai if m1==1
			ebalance m1 ml_roeth  language_region mountain_region  log_density perc14 special pop_ipep const_gdppc_ipep gdp_growth number_region duration_y seat_share_gov nr_parties_gov cap_national_economic rai_self_rule rai_shared_rule reai
			probit m1 ml_roeth   mountain_region  log_density perc14  pop_ipep const_gdppc_ipep gdp_growth  duration_y   cap_national_economic rai_self_rule rai_shared_rule 
			
			mdesc ml_roeth log_density perc14   const_gdppc_ipep gdp_growth number_region duration_y   cap_national_economic rai_self_rule rai_shared_rule reai if m2==1
			ebalance m2  rai_self_rule rai_shared_rule , tar(2)
			probit m2 rai_self_rule rai_shared_rule reai

			mdesc  ml_roeth  language_region mountain_region  log_density perc14 special pop_ipep const_gdppc_ipep gdp_growth number_region duration_y seat_share_gov nr_parties_gov cap_national_economic rai_self_rule rai_shared_rule reai if m3==1
			ebalance m3 ml_roeth  language_region mountain_region  log_density perc14 special pop_ipep   number_region duration_y seat_share_gov nr_parties_gov cap_national_economic rai_self_rule rai_shared_rule reai
			probit m3 ml_roeth  language_region mountain_region  log_density perc14 special pop_ipep   number_region duration_y seat_share_gov nr_parties_gov cap_national_economic rai_self_rule rai_shared_rule reai

			mdesc  ml_roeth  language_region mountain_region unemp log_density perc14 special pop_ipep const_gdppc_ipep gdp_growth number_region duration_y seat_share_gov nr_parties_gov cap_national_economic rai_self_rule rai_shared_rule rai_overall if  const_edupc!=.
			mdesc  ml_roeth  language_region mountain_region unemp log_density perc14 special pop_ipep const_gdppc_ipep gdp_growth number_region duration_y seat_share_gov nr_parties_gov cap_national_economic rai_self_rule rai_shared_rule rai_overall if  const_edupc!=. 
			
		*5.2 Alternative specifications | Table A5
		
		* Standard Benchmark Model
			xtmixed const_edupc  c.ml_roeth##c.reai ideological_proximity cap_national_economic mountain_region unemp log_density perc14  special language_region pop_ipep const_gdppc_ipep gdp_growth number_region duration_y nr_parties_gov || country_id:||r_id:,var mle cov(un) res(ar 1, t(year))
			margins, dydx(ml_roeth) at (reai=(0 (1) 6))
			marginsplot, recast(scatter) scheme(s1mono) yline(0) ytitle("marginal effect") ///
			xtitle("Level of regional authority over education") title("Marginal effect of regional government ideology")
			graph save r1.gph, replace
			*eststo model3
		
		* Fixed Effects  - mle
			xtmixed const_edupc  c.ml_roeth##c.reai ideological_proximity cap_national_economic mountain_region unemp log_density perc14  special language_region pop_ipep const_gdppc_ipep gdp_growth number_region duration_y nr_parties_gov i.r_id ||r_id:,var mle cov(un) res(ar 1, t(year))
			margins, dydx(ml_roeth) at (reai=(0 (1) 6))
			marginsplot, recast(scatter) scheme(s1mono) yline(0) ytitle("marginal effect") ///
			xtitle("Level of regional authority over education") title("Marginal effect of regional government ideology")

		* Fixed effects without ML
			xtreg const_edupc  c.ml_roeth##c.reai ideological_proximity cap_national_economic mountain_region unemp log_density perc14  special language_region pop_ipep const_gdppc_ipep gdp_growth number_region duration_y nr_parties_gov, fe 
			margins, dydx(ml_roeth) at (reai=(0 (1) 6))
			marginsplot, recast(scatter) scheme(s1mono) yline(0) ytitle("marginal effect") ///
			xtitle("Level of regional authority over education") title("Marginal effect of regional government ideology")

			xtreg const_edupc l.const_edupc c.ml_roeth##c.reai ideological_proximity cap_national_economic mountain_region unemp log_density perc14  special language_region pop_ipep const_gdppc_ipep gdp_growth number_region duration_y nr_parties_gov, fe 
	
		
		* Random effects without ML
			xtreg const_edupc  c.ml_roeth##c.reai ideological_proximity cap_national_economic mountain_region unemp log_density perc14  special language_region pop_ipep const_gdppc_ipep gdp_growth number_region duration_y nr_parties_gov 
			margins, dydx(ml_roeth) at (reai=(0 (1) 6))
			marginsplot, recast(scatter) scheme(s1mono) yline(0) ytitle("marginal effect") ///
			xtitle("Level of regional authority over education") title("Marginal effect of regional government ideology")
		
		* OLS
			reg const_edupc  c.ml_roeth##c.reai ideological_proximity cap_national_economic mountain_region unemp log_density perc14  special language_region pop_ipep const_gdppc_ipep gdp_growth number_region duration_y nr_parties_gov 

		
		*5.3 Alternative Authority Scales | Table A7
		
			* Correlations of different REAI concepts | Table 7
			
			gen reai_plus=scope_education+depth_education
			gen iak_3=reai*reg_fiscal_authority
			gen iak_4=reai_plus+reg_fiscal_authority

			cor reai scope_education depth_education reai reai_plus iak_3 iak_4 reg_fiscal_authority rai_overall rai_shared_rule rai_self_rule

			cor reai rai_overall rai_shared_rule rai_self_rule if country=="Spain"
			cor reai rai_overall rai_shared_rule rai_self_rule if country=="Italy"
			cor reai rai_overall rai_shared_rule rai_self_rule if country=="Australia"
			cor reai rai_overall rai_shared_rule rai_self_rule if country=="Belgium"
			cor reai rai_overall rai_shared_rule rai_self_rule if country=="France"
			cor reai rai_overall rai_shared_rule rai_self_rule if country=="UK"

			* Table A7 entails results of the follwoing models
		
			* Just scope
			sum scope_education, d
			xtmixed const_edupc  c.ml_roeth##c.scope_education ideological_proximity cap_national_economic mountain_region unemp log_density perc14  special language_region pop_ipep const_gdppc_ipep gdp_growth number_region duration_y nr_parties_gov ||r_id:,var mle cov(un) res(ar 1, t(year))
			margins, dydx(ml_roeth) at (scope_education=(0 (1) 6))
			marginsplot, recast(scatter) scheme(s1mono) yline(0) ytitle("marginal effect") ///
			xtitle("Level of regional authority over education") title("Marginal effect of regional government ideology")

			* Just depth
			sum depth_education, d
			xtmixed const_edupc  c.ml_roeth##c.depth_education ideological_proximity cap_national_economic mountain_region unemp log_density perc14  special language_region pop_ipep const_gdppc_ipep gdp_growth number_region duration_y nr_parties_gov ||r_id:,var mle cov(un) res(ar 1, t(year))
			margins, dydx(ml_roeth) at (depth_education=(0 (1) 3))
			marginsplot, recast(scatter) scheme(s1mono) yline(0) ytitle("marginal effect") ///
			xtitle("Level of regional authority over education") title("Marginal effect of regional government ideology")

			* Scope and depth additive
			sum reai_plus, d
			xtmixed const_edupc  c.ml_roeth##c.reai_plus ideological_proximity cap_national_economic mountain_region unemp log_density perc14  special language_region pop_ipep const_gdppc_ipep gdp_growth number_region duration_y nr_parties_gov ||r_id:,var mle cov(un) res(ar 1, t(year))
			margins, dydx(ml_roeth) at (reai=(0 (1) 5))
			marginsplot, recast(scatter) scheme(s1mono) yline(0) ytitle("marginal effect") ///
			xtitle("Level of regional authority over education") title("Marginal effect of regional government ideology")
		
			* Scope * depth * fiscal
			sum iak_3, d
			xtmixed const_edupc  c.ml_roeth##c.iak_3 ideological_proximity cap_national_economic mountain_region unemp log_density perc14  special language_region pop_ipep const_gdppc_ipep gdp_growth number_region duration_y nr_parties_gov ||r_id:,var mle cov(un) res(ar 1, t(year))
			margins, dydx(ml_roeth) at (iak_3=(0 (1) 24))
			marginsplot, recast(scatter) scheme(s1mono) yline(0) ytitle("marginal effect") ///
			xtitle("Level of regional authority over education") title("Marginal effect of regional government ideology")
	
			* Scope + depth + fiscal
			sum iak_4, d
			xtmixed const_edupc  c.ml_roeth##c.iak_4 ideological_proximity cap_national_economic mountain_region unemp log_density perc14  special language_region pop_ipep const_gdppc_ipep gdp_growth number_region duration_y nr_parties_gov ||r_id:,var mle cov(un) res(ar 1, t(year))
			margins, dydx(ml_roeth) at (iak_4=(0 (1) 9))
			marginsplot, recast(scatter) scheme(s1mono) yline(0) ytitle("marginal effect") ///
			xtitle("Level of regional authority over education") title("Marginal effect of regional government ideology")

			* RAI
			sum rai_overall, d
			xtmixed const_edupc  c.ml_roeth##c.rai_overall ideological_proximity cap_national_economic mountain_region unemp log_density perc14  special language_region pop_ipep const_gdppc_ipep gdp_growth number_region duration_y nr_parties_gov ||r_id:,var mle cov(un) res(ar 1, t(year))
			margins, dydx(ml_roeth) at (rai_overall=(0 (1) 27))
			marginsplot, recast(scatter) scheme(s1mono) yline(0) ytitle("marginal effect") ///
			xtitle("Level of regional authority over education") title("Marginal effect of regional government ideology")
	
			sum rai_self_rule, d
			xtmixed const_edupc  c.ml_roeth##c.rai_self_rule ideological_proximity cap_national_economic mountain_region unemp log_density perc14  special language_region pop_ipep const_gdppc_ipep gdp_growth number_region duration_y nr_parties_gov ||r_id:,var mle cov(un) res(ar 1, t(year))
			margins, dydx(ml_roeth) at (rai_self_rule=(0 (1) 18))
			marginsplot, recast(scatter) scheme(s1mono) yline(0) ytitle("marginal effect") ///
			xtitle("Level of regional authority over education") title("Marginal effect of regional government ideology")

	* 5.4) Country Dependency | Table A9-A11
	
			xtreg const_edupc  c.ml_roeth##c.reai ideological_proximity cap_national_economic mountain_region unemp log_density perc14  special language_region pop_ipep const_gdppc_ipep gdp_growth number_region duration_y nr_parties_gov, fe 
			xtreg const_edupc  c.ml_roeth##c.reai ideological_proximity cap_national_economic mountain_region unemp log_density perc14  special language_region pop_ipep const_gdppc_ipep gdp_growth number_region duration_y nr_parties_gov if countryname!="Australia", fe 
			xtreg const_edupc  c.ml_roeth##c.reai ideological_proximity cap_national_economic mountain_region unemp log_density perc14  special language_region pop_ipep const_gdppc_ipep gdp_growth number_region duration_y nr_parties_gov if countryname!="Austria", fe 
			xtreg const_edupc  c.ml_roeth##c.reai ideological_proximity cap_national_economic mountain_region unemp log_density perc14  special language_region pop_ipep const_gdppc_ipep gdp_growth number_region duration_y nr_parties_gov if countryname!="Belgium", fe 
			xtreg const_edupc  c.ml_roeth##c.reai ideological_proximity cap_national_economic mountain_region unemp log_density perc14  special language_region pop_ipep const_gdppc_ipep gdp_growth number_region duration_y nr_parties_gov if countryname!="Canada", fe 
			xtreg const_edupc  c.ml_roeth##c.reai ideological_proximity cap_national_economic mountain_region unemp log_density perc14  special language_region pop_ipep const_gdppc_ipep gdp_growth number_region duration_y nr_parties_gov if countryname!="Denmark", fe 
			xtreg const_edupc  c.ml_roeth##c.reai ideological_proximity cap_national_economic mountain_region unemp log_density perc14  special language_region pop_ipep const_gdppc_ipep gdp_growth number_region duration_y nr_parties_gov if countryname!="France", fe 
			xtreg const_edupc  c.ml_roeth##c.reai ideological_proximity cap_national_economic mountain_region unemp log_density perc14  special language_region pop_ipep const_gdppc_ipep gdp_growth number_region duration_y nr_parties_gov if countryname!="Germany", fe 
			xtreg const_edupc  c.ml_roeth##c.reai ideological_proximity cap_national_economic mountain_region unemp log_density perc14  special language_region pop_ipep const_gdppc_ipep gdp_growth number_region duration_y nr_parties_gov if countryname!="Italy", fe 
			xtreg const_edupc  c.ml_roeth##c.reai ideological_proximity cap_national_economic mountain_region unemp log_density perc14  special language_region pop_ipep const_gdppc_ipep gdp_growth number_region duration_y nr_parties_gov if countryname!="Japan", fe 
			xtreg const_edupc  c.ml_roeth##c.reai ideological_proximity cap_national_economic mountain_region unemp log_density perc14  special language_region pop_ipep const_gdppc_ipep gdp_growth number_region duration_y nr_parties_gov if countryname!="Norway", fe 
			xtreg const_edupc  c.ml_roeth##c.reai ideological_proximity cap_national_economic mountain_region unemp log_density perc14  special language_region pop_ipep const_gdppc_ipep gdp_growth number_region duration_y nr_parties_gov if countryname!="Spain", fe 
			xtreg const_edupc  c.ml_roeth##c.reai ideological_proximity cap_national_economic mountain_region unemp log_density perc14  special language_region pop_ipep const_gdppc_ipep gdp_growth number_region duration_y nr_parties_gov if countryname!="Sweden", fe 
			xtreg const_edupc  c.ml_roeth##c.reai ideological_proximity cap_national_economic mountain_region unemp log_density perc14  special language_region pop_ipep const_gdppc_ipep gdp_growth number_region duration_y nr_parties_gov if countryname!="Switzerland", fe 
			xtreg const_edupc  c.ml_roeth##c.reai ideological_proximity cap_national_economic mountain_region unemp log_density perc14  special language_region pop_ipep const_gdppc_ipep gdp_growth number_region duration_y nr_parties_gov if countryname!="United Kingdom", fe 
			xtreg const_edupc  c.ml_roeth##c.reai ideological_proximity cap_national_economic mountain_region unemp log_density perc14  special language_region pop_ipep const_gdppc_ipep gdp_growth number_region duration_y nr_parties_gov if countryname!="United States", fe 
		
	* 5.5) Control Dependency | Table A12
			
			xtreg const_edupc  c.ml_roeth##c.reai ideological_proximity cap_national_economic mountain_region unemp log_density perc14  special language_region pop_ipep const_gdppc_ipep gdp_growth number_region duration_y nr_parties_gov, fe 
			xtreg const_edupc  c.ml_roeth##c.reai  cap_national_economic mountain_region unemp log_density perc14  special language_region pop_ipep const_gdppc_ipep gdp_growth number_region duration_y nr_parties_gov, fe 
			xtreg const_edupc  c.ml_roeth##c.reai ideological_proximity  mountain_region unemp log_density perc14  special language_region pop_ipep const_gdppc_ipep gdp_growth number_region duration_y nr_parties_gov, fe 
			xtreg const_edupc  c.ml_roeth##c.reai ideological_proximity cap_national_economic mountain_region unemp log_density perc14  special language_region pop_ipep const_gdppc_ipep gdp_growth number_region duration_y nr_parties_gov, fe
			xtreg const_edupc  c.ml_roeth##c.reai ideological_proximity cap_national_economic  unemp log_density perc14  special language_region pop_ipep const_gdppc_ipep gdp_growth number_region duration_y nr_parties_gov, fe
			xtreg const_edupc  c.ml_roeth##c.reai ideological_proximity cap_national_economic mountain_region  log_density perc14  special language_region pop_ipep const_gdppc_ipep gdp_growth number_region duration_y nr_parties_gov, fe
			xtreg const_edupc  c.ml_roeth##c.reai ideological_proximity cap_national_economic mountain_region unemp  perc14  special language_region pop_ipep const_gdppc_ipep gdp_growth number_region duration_y nr_parties_gov, fe
			xtreg const_edupc  c.ml_roeth##c.reai ideological_proximity cap_national_economic mountain_region unemp log_density   special language_region pop_ipep const_gdppc_ipep gdp_growth number_region duration_y nr_parties_gov, fe
			xtreg const_edupc  c.ml_roeth##c.reai ideological_proximity cap_national_economic mountain_region unemp log_density perc14   language_region pop_ipep const_gdppc_ipep gdp_growth number_region duration_y nr_parties_gov, fe 
			xtreg const_edupc  c.ml_roeth##c.reai ideological_proximity cap_national_economic mountain_region unemp log_density perc14  special  pop_ipep const_gdppc_ipep gdp_growth number_region duration_y nr_parties_gov, fe 
			xtreg const_edupc  c.ml_roeth##c.reai ideological_proximity cap_national_economic mountain_region unemp log_density perc14  special language_region  const_gdppc_ipep gdp_growth number_region duration_y nr_parties_gov, fe 
			xtreg const_edupc  c.ml_roeth##c.reai ideological_proximity cap_national_economic mountain_region unemp log_density perc14  special language_region pop_ipep  gdp_growth number_region duration_y nr_parties_gov, fe 
			xtreg const_edupc  c.ml_roeth##c.reai ideological_proximity cap_national_economic mountain_region unemp log_density perc14  special language_region pop_ipep const_gdppc_ipep  number_region duration_y nr_parties_gov, fe 
			xtreg const_edupc  c.ml_roeth##c.reai ideological_proximity cap_national_economic mountain_region unemp log_density perc14  special language_region pop_ipep const_gdppc_ipep gdp_growth  duration_y nr_parties_gov, fe 
			xtreg const_edupc  c.ml_roeth##c.reai ideological_proximity cap_national_economic mountain_region unemp log_density perc14  special language_region pop_ipep const_gdppc_ipep gdp_growth number_region  nr_parties_gov, fe 
			xtreg const_edupc  c.ml_roeth##c.reai ideological_proximity cap_national_economic mountain_region unemp log_density perc14  special language_region pop_ipep const_gdppc_ipep gdp_growth number_region duration_y , fe 
			
	* 5.6) Altenative Ideology Scales | Table A13
	
			mdesc  ml_roeth left_right_RILE  culture_franzmann state_market_franzmann if  const_edupc!=.

		* Identify smallest denominator in order to identify excat same observations
			xtreg const_edupc  c.ml_roeth##c.reai ideological_proximity cap_national_economic mountain_region unemp log_density perc14  special language_region pop_ipep const_gdppc_ipep gdp_growth number_region duration_y nr_parties_gov, fe 
			predict xb
			rename xb xb__1
			sum xb__1

			xtreg const_edupc  c.left_right_RILE##c.reai ideological_proximity cap_national_economic mountain_region unemp log_density perc14  special language_region pop_ipep const_gdppc_ipep gdp_growth number_region duration_y nr_parties_gov, fe 
			predict xb
			rename xb xb__2

			xtreg const_edupc  c.left_right_franzmann##c.reai ideological_proximity cap_national_economic mountain_region unemp log_density perc14  special language_region pop_ipep const_gdppc_ipep gdp_growth number_region duration_y nr_parties_gov, fe 
			predict xb
			rename xb xb__3
			sum xb__1 xb__2 xb__3
		
			gen included=0
			replace included=1 if xb__1!=. & xb__2!=. & xb__3!=.
			
			xtreg const_edupc  c.ml_roeth##c.reai ideological_proximity cap_national_economic mountain_region unemp log_density perc14  special language_region pop_ipep const_gdppc_ipep gdp_growth number_region duration_y nr_parties_gov if included==1, fe 
			xtreg const_edupc  c.ml_roeth##c.reai ideological_proximity cap_national_economic mountain_region unemp log_density perc14  special language_region pop_ipep const_gdppc_ipep gdp_growth number_region duration_y nr_parties_gov if included==1
			xtmixed const_edupc  c.ml_roeth##c.reai ideological_proximity cap_national_economic mountain_region unemp log_density perc14  special language_region pop_ipep const_gdppc_ipep gdp_growth number_region duration_y nr_parties_gov if included==1 || country_id:||r_id:,var mle cov(un) res(ar 1, t(year))
		
			xtreg const_edupc  c.left_right_RILE##c.reai ideological_proximity cap_national_economic mountain_region unemp log_density perc14  special language_region pop_ipep const_gdppc_ipep gdp_growth number_region duration_y nr_parties_gov if included==1, fe 
			xtreg const_edupc  c.left_right_RILE##c.reai ideological_proximity cap_national_economic mountain_region unemp log_density perc14  special language_region pop_ipep const_gdppc_ipep gdp_growth number_region duration_y nr_parties_gov if included==1
			xtmixed const_edupc  c.left_right_RILE##c.reai ideological_proximity cap_national_economic mountain_region unemp log_density perc14  special language_region pop_ipep const_gdppc_ipep gdp_growth number_region duration_y nr_parties_gov if included==1 || country_id:||r_id:,var mle cov(un) res(ar 1, t(year))

			sum left_right_RILE

			xtreg const_edupc  c.left_right_franzmann##c.reai ideological_proximity cap_national_economic mountain_region unemp log_density perc14  special language_region pop_ipep const_gdppc_ipep gdp_growth number_region duration_y nr_parties_gov if included==1, fe 
			xtreg const_edupc  c.left_right_franzmann##c.reai ideological_proximity cap_national_economic mountain_region unemp log_density perc14  special language_region pop_ipep const_gdppc_ipep gdp_growth number_region duration_y nr_parties_gov if included==1
			xtmixed const_edupc  c.left_right_franzmann##c.reai ideological_proximity cap_national_economic mountain_region unemp log_density perc14  special language_region pop_ipep const_gdppc_ipep gdp_growth number_region duration_y nr_parties_gov if included==1 || country_id:||r_id:,var mle cov(un) res(ar 1, t(year))
			sum left_right_franzmann
		
			xtreg const_edupc  c.culture_franzmann##c.reai ideological_proximity cap_national_economic mountain_region unemp log_density perc14  special language_region pop_ipep const_gdppc_ipep gdp_growth number_region duration_y nr_parties_gov if included==1, fe 
			xtreg const_edupc  c.state_market_franzmann##c.reai ideological_proximity cap_national_economic mountain_region unemp log_density perc14  special language_region pop_ipep const_gdppc_ipep gdp_growth number_region duration_y nr_parties_gov if included==1, fe 
	
	* 5.7) Opportunity structures | Table A14
	
			xtreg const_edupc ml_roeth  ideological_proximity cap_national_economic mountain_region unemp log_density perc14  special language_region pop_ipep const_gdppc_ipep gdp_growth number_region duration_y nr_parties_gov if reai>=2
			xtreg const_edupc c.ml_roeth##c.nr_parties_gov   ideological_proximity cap_national_economic mountain_region unemp log_density perc14  special language_region pop_ipep const_gdppc_ipep gdp_growth number_region duration_y  if reai>=2
			
			xtreg const_edupc c.ml_roeth##c.ideological_proximity    cap_national_economic mountain_region unemp log_density perc14  special language_region pop_ipep const_gdppc_ipep gdp_growth number_region duration_y nr_parties_gov if reai>=2
			margins, dydx(ml_roeth) at (ideological_proximity=(0 (0.1) 1))
			marginsplot, recast(scatter) scheme(s1mono) yline(0) ytitle("marginal effect") ///
			xtitle("Ideological Proximity") title("Marginal effect of regional government ideology")
			graph save 1c.gph, replace

		* Test of non-linearity
			
			* install interflex if neccessary!
			interflex const_edupc ml_roeth ideological_proximity  cap_national_economic mountain_region unemp log_density perc14  special language_region pop_ipep const_gdppc_ipep gdp_growth number_region duration_y nr_parties_gov if reai>=2, type(kernel) cl(r_id)
			graph save 2c.gph, replace
			grc1leg  1c.gph 2c.gph, rows(2) graphregion(color(white) margin(0))

* ### THE END ## *
	
					

	
